#include "rspinterface.h"

RspInterface::RspInterface()
{

}

void RspInterface::SetRsp(const RspBase rsp)
{
    m_rsp = rsp;
}

QString RspInterface::get(const QString qsName)
{
    return m_rsp.GetQStringPara(qsName);
}

int RspInterface::getAlmSize(const QString qsAlmName)
{
    auto it = m_alms.find(qsAlmName);
    if (it != m_alms.end())
        return it.value().size();
    return 0;
}

QString RspInterface::getAlmString(const QString qsAlmName, int row, int column)
{
//    qDebug()<<"qsAlmName:"<<qsAlmName<<" row:"<<row<<" column:"<<column;
    auto it = m_alms.find(qsAlmName);
    if (it != m_alms.end() && row>=0 && column >= 0)
        return it.value().GetValue(row).GetQValue(column).toString();

    return "";
}

AlmListModel *RspInterface::getAlmModel(const QString qsAlmName,const QString qslistName,bool bWithCheck)
{
    AlmListModel *pModel = new AlmListModel;
    pModel->InitAlmData(m_alms[qsAlmName]);
    pModel->InitRoleNames(qslistName);
    pModel->setShowCheck(bWithCheck, false);
    return pModel;
}

//AlmListModel *RspInterface::getAlmModel(const QString qsAlmName)
//{
//    AlmListModel *pModel = new AlmListModel;
//    pModel->InitAlmData(m_alms[qsAlmName]);
//    pModel->InitRoleNames("RiskTryCalc");
//    return pModel;
//}
